#include <iostream>

class A {
public:
    void print () {
        std::cout << "A.print()" << std::endl;
    }

};

class B : public A {
public:
    void print () {
        std::cout << "B.print()" << std::endl;
    }
};

int main () {

    B b;
    A* a = (A *)(&b);
    a->print();

    return 0;
}